import 'package:flutter/material.dart';

class GoodsCard extends StatelessWidget {
  const GoodsCard(this._name, this._price, {super.key});

  final String _name;
  final double _price;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(5.0),
      child: SizedBox(
        width: double.infinity,
        height: 60.0,
        child: DecoratedBox(
          decoration: BoxDecoration(
            color: Colors.blue[100],
            borderRadius: BorderRadius.circular(3.0), //3像素圆角
            boxShadow: const [
              BoxShadow(color: Colors.black54, offset: Offset(2.0, 2.0), blurRadius: 4.0)
            ],
          ),
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 5.0),
            child: Row(
              children: <Widget>[
                Text(_name, style: const TextStyle(fontSize: 18.0)),
                const Padding(padding: EdgeInsets.symmetric(horizontal: 20.0)),
                Text(_price.toString(), style: const TextStyle(fontSize: 18.0)),
                IconButton(onPressed: () {}, icon: const Icon(Icons.add)),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
